home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ppc.basic2.9b2 Folder / chipbasic.2.9b2.README next >
Text File  |  1994-03-17  |  4KB  |  117 lines

  1. *ppc_chipbasic 2.9b2 README*
  2.  
  3. Every *real* personal computer should come with a BASIC interpreter.
  4. Here's my contribution for the new Power Macintosh machines.  It's a
  5. line number based BASIC interpreter similar to the Applesoft BASIC that
  6. came with the Apple ][+ (that's Apple ][, *NOT* Mac II for you
  7. newcomers).  This version runs ONLY on Power Macs.
  8.  
  9. Chipmunk Basic is a simple Basic interpreter for the Macintosh.  It is
  10. similar to the line number based MumbleSoft BASIC interpreters of circa
  11. 1980.  Its roots are from a pascal program, basic.p, that was part of
  12. the test input suite to p2c, a pascal to c translator.  Both basic.p
  13. and p2c should be in the net.sources archives somewhere (I no longer
  14. have copies).  I cleaned up the translated source, ported it to the Mac
  15. and added some Mac specific features.
  16.  
  17. Chipmunk Basic 2.9 is being distributed as freeware (but only for those who
  18. don't believe that using the BASIC language causes brain damage. :-)
  19. Please note that there are far better versions of BASIC available
  20. commercially.  Just none that run PowerPC native and are available for
  21. the Mac as of March 14th.
  22.  
  23. Version 2.9b2 fixes a static text bug when running under virtual memory.
  24.  
  25. This program is distributed in the hope that it will be useful, but
  26. WITHOUT ANY WARRANTY; not even the implied warranty of MERCHANTABILITY
  27. or FITNESS FOR A PARTICULAR PURPOSE.
  28.  
  29. ---
  30. Quick Reference for Chipmunk Basic v2.9b2 - Macintosh version
  31. ported by Ronald H. Nicholson, Jr.    94-Mar-14    rhn@netcom.com
  32.  
  33. - This is a simple version of Basic similar to Applesoft BASIC.
  34. - The interpreter includes a standard line number based editor.
  35. - The usual amount of numeric and string operators and functions and
  36.     file I/O statements are available.
  37. - The two variable types are long floats and strings with a maximum length
  38.     of 254 characters.  Variable names can be up to 32 characters long.
  39. - Unusual features include:
  40.     The ability to play accurate morse code through the sound manager.
  41.     Some simple graphics commands in a separate graphics window.
  42.  
  43. Operator, functions and statements include:
  44.  
  45.     + - * / ^ mod and or xor not
  46.     sqr() log() exp() abs() sgn() sin() cos() tan() log() arctan()
  47.     int() rnd() peek() val() asc() len() fre
  48.     mid$() right$() left$() str$() chr$()
  49.     let goto gosub return for to step next while wend dim data read def
  50.     rem input print open input# output append as close# load save run
  51.     inkey$ date$ time$
  52.     timer eof()
  53.     stop end exit quit renum new
  54.     moveto lineto gotoxy graphics() mouse() cls sound morse
  55.     
  56. Some Examples:
  57.  
  58.   open "filename" for output as #1 : print #1, a$ : close #1
  59.   c$ = a$ + b$                : rem string concatenation
  60.   
  61.   graphics(0) : moveto 10,10 : lineto 110,80    : rem graphics window
  62.   gotoxy 0,10 : print "here"        : rem text window
  63.   sound 440,0.5,30            : rem freq, secs_dur, vol 0-100
  64.   sound 0,128                : rem play snd resource 128
  65.   morse "CQ DE N6YWU",16,40,13,700    : rem dot_wpm,vol,letter_wpm,freq
  66.   open "SFGetFile" for input as #2    : rem "SFPutFile" works for output also
  67.   
  68.   some experimental graphics commands:
  69.   (The graphics commands in version 2.9b are beta test and may be buggy.)
  70.     
  71.     GRAPHICS 0                // init graphics window
  72.  
  73.     graphics MOVETO  x,y            // MoveTo
  74.     graphics LINETO  x,y            // LineTo
  75.     graphics OVAL  x,y            // oval  x wide by y high
  76.     graphics DRAWTEXT  a$            // DrawText
  77.     
  78.     graphics RECT  x1,y1,x2,y2        // FrameRect
  79.     graphics FILLRECT  x1,y1,x2,y2,pat#    // PaintRect
  80.     graphics OVAL  x1,y1,x2,y2        // FrameOval
  81.     graphics FILLOVAL  x1,y1,x2,y2,pat#    // PaintOval
  82.     graphics PENSETUP  xsize, ysize, [ mode, pat# ]
  83.     graphics COLOR  i            // set RGBForeColor by index
  84.     graphics COLOR  r,g,b            // red green blue 0-100
  85.  
  86.     graphics TEXTSETUP f, s, m        // font, size, mode
  87.  
  88.     SPRITE    n  x, y, id        // sprite n @ x,y using ICN# id
  89.                     // n from 1 to 15, 1 in frontmost plane
  90.     sprite    n  UP    x        // sprite #n move up x pixels
  91.     sprite  n  DOWN  x
  92.     sprite  n  LEFT  x        // move LEFT (not turn as in Logo!)
  93.     sprite  n  RIGHT   x
  94.     sprite    n  TURN    d        // turn CCW d degrees
  95.     sprite    n  FORWARD x        // move forward x pixels
  96.     sprite    n  PENUP
  97.     sprite    n  PENDOWN
  98.  
  99. ---
  100. 1 rem sieve benchmark
  101. 2 t = timer
  102. 3 dim f(8194)
  103. 4 for i = 0 to 8191 : f(i) = 1 : next i
  104. 5 s = 8191
  105. 6 for i = 0 to s
  106. 7   if f(i) = 0 then goto 11
  107. 8   p = i+i+3
  108. 9 for k = i+p to s step p : f(k) = 0 : next k
  109. 10   c = c+1
  110. 11 next i
  111. 12 print c;" primes found in ";
  112. 13 t = timer-t
  113. 14 print t;" seconds"
  114. 15 end
  115.  
  116. --- cut here ---
  117.